<template>
  <div style="position: absolute;">
     <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545998677834&di=c107d881ee4d230dbbb61f85900462c2&imgtype=0&src=http%3A%2F%2Fimg.5snow.com%2Ffiles%2F3%2F3f5fc1e9b113994769247a862a49aa37.jpg" @click="handleView">
    <h1>{{ msg }}</h1>
    <image-preview ref="imgPreviewRef"></image-preview>
  </div>
</template>

<script>
import imagePreview from "./image-preview/imagePreview.vue";
import iconLeft from "@/assets/logo.png";

export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: '点击图片显示图片预览'
    }
  },
  components: {imagePreview},
  methods:{
     handleView (item) {
        this.imgName = item.name;
        this.imgUrl = item.url;
        let uploadImagesUrlArr = ["https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545998677834&di=c107d881ee4d230dbbb61f85900462c2&imgtype=0&src=http%3A%2F%2Fimg.5snow.com%2Ffiles%2F3%2F3f5fc1e9b113994769247a862a49aa37.jpg","https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2831602147,1387396865&fm=26&gp=0.jpg","https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2981055220,2468440965&fm=26&gp=0.jpg"]
        this.$refs.imgPreviewRef.loadImages(uploadImagesUrlArr);
    },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
